<template>
  <div class="context-menus">
    <div
      v-for="(item, i) in contextMenuList"
      :key="i"
      class="context-menus-item"
      @click="handleMenuSelect(item)"
    >
      {{ item.name }}
    </div>
  </div>
</template>
<script>
export default {
  name: 'CanvasContextMenu',
  props: {
    contextMenuList: {
      type: Array,
      default: () => []
    }
  },
  data() {
    return {}
  },
  methods: {
    handleMenuSelect(val) {
      this.$emit('context', val)
    }
  }
}
</script>

<style lang="scss" scoped>
.context-menus {
  position: fixed;
  z-index: 10;
  background-color: #ffffff;
}
.context-menus-item {
  width: 150px;
  height: 35px;
  line-height: 35px;
  padding: 0 30px;
  color: #666666;
  font-size: 14px;
  text-align: center;
  &:hover {
    background-color: #eee;
    cursor: pointer;
  }
}

.line {
  background-color: transparent !important;
  padding: 0;
  margin: 5px 0;
  border-top: 1px solid #eee;
}
</style>
